package com.jasmine.bjstkserver.manager.weather;

import com.jasmine.auth.util.AuthUtil;
import com.jasmine.bjstkserver.server.dict.DictService;
import com.jasmine.core.dto.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author jasmineXz
 */
@RestController
@RequestMapping("/weather")
public class WeatherController {

    @Autowired
    private WeatherManager weatherManager;

    @Autowired
    private DictService dictService;

    @GetMapping
    public R weather() {
        String value = dictService.getDictValue(
                WeatherManager.HEFENG_DICT_ID,
                WeatherManager.HEFENG_DICT_LOCATION,
                AuthUtil.getUserId());
        return R.ok(weatherManager.findWeatherAll(value,null));
    }

}
